<template>
  <div class="living-container">
    <div class="header">
      <img :src="logo" style="width: 174px" />
      <div class="right">
        <img class="avatar" :src="headerImg" />
        <span class="telphone m-l-7 m-r-7">
          {{ phone }}
        </span>
        <el-dropdown>
          <el-icon>
            <ArrowDown />
          </el-icon>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item @click="logOut">退出</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </div>
    <div class="main-box">
      <div class="side left">
        <AudienceList />
      </div>
      <div class="center">
        <div class="top box live_box">
          <LiveWindow />
        </div>
        <div class="bottom box">
          <RoomManage />
        </div>
      </div>
      <div class="side right">
        <ChatBox />
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import logo from "@/assets/ranyu_logo.png";
import headerImg from "@/assets/register/default_avator.png";
import RoomManage from "./components/RoomManage.vue";
import ChatBox from "./components/ChatBox.vue";
import LiveWindow from "./components/LiveWindow.vue";
import AudienceList from "./components/AudienceList.vue";

const phone = localStorage.getItem("phone");
const logOut = () => {
  localStorage.clear();
  location.reload();
};

const microphoneCount = ref(0);
const updateMicrophone = (num: number) => {
  microphoneCount.value = num;
};
provide("microphone", {
  microphoneCount,
  updateMicrophone,
});
</script>
<style lang="scss" scoped>
.living-container {
  width: 100%;
  height: 100%;
  background: #222222;
  display: flex;
  flex-direction: column;
  // min-height: 1200px;
  min-width: 1400px;

  .header {
    height: 60px;
    background: #f1f1f9;
    padding: 7px 16px;
    padding-right: 34px;
    box-shadow: 0px 4px 10px 0px rgba(78, 89, 105, 0.06);
    display: flex;
    justify-content: space-between;

    .right {
      display: flex;
      align-items: center;

      .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
      }
    }
  }

  .main-box {
    flex: 1;
    display: flex;
    gap: 10px;
    padding: 25px 15px;
    background: #222222;
    min-width: 1730px;
    .side {
      min-width: 212px;
      width: 15%;
      border-radius: 16px;
      background: rgba(255, 255, 255, 0.1);
      height: calc(100vh - 110px);
      overflow: hidden;
      min-height: 1010px;
    }

    .right {
      min-width: 360px;
    }
    .left {
      padding: 14px;
      min-width: 360px;
    }

    .center {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 10px;

      .box {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 16px;
      }

      .top {
        padding: 16px;
        flex: 1;
        // min-height: 450px;
      }

      .bottom {
        display: flex;
        min-height: 400px;
        padding: 20px 14px;
      }
      .live_box {
        background-image: url("@/assets/live/live_bg.png");
        background-size: 100% 100%;
        border-radius: 30px;
        z-index: 1;
        position: relative;
        // background-color: rgba(0, 0, 0, 0.5); /* 在背景图片上叠加黑色半透明蒙层 */
      }
      // .live_box::after {
      //   /* 使用伪元素作为蒙层 */
      //   border-radius: 30px;
      //   content: "";
      //   position: absolute; /* 或其他定位方式 */
      //   top: 0;
      //   left: 0;
      //   right: 0;
      //   bottom: 0; /* 全覆盖 */
      //   background-color: rgba(0, 0, 0, 0.2); /* 黑色，50%透明度 */
      //   z-index: -1; /* 如果需要的话，确保它在内容之下 */
      // }
    }
  }
}
</style>
